package com.softaria.windows.factories;

import com.softaria.windows.logic.HelpWriter;
import com.softaria.windows.model.ModelUrl;
import com.softaria.windows.model.Perspective;
import com.softaria.windows.model.View;
import com.softaria.windows.widgets.FrameResizeListener;
import com.softaria.windows.widgets.ResizeListenerRegistrator;

/**
 * Creating views is outside the scope of the system. So, to create them system
 * provides interface ViewFactory, which should be implemented by framework
 * user. The goal of ViewFactory is creating View object from ViewUrl object.
 * 
 * 
 * @author Roman M Kuzmin (roman@softaria.com)
 * 
 */
public interface PerspectiveFactory extends ModelFactory {

  /**
   * 
   * @param url
   *          - perspective to be created
   * @param closeListenerRegistrator
   *          - you may register {@link CloseListener} with this object to be
   *          notified when your views Frame is closed and to control closing
   *          process
   * @param frlr
   *          - you may register {@link FrameResizeListener} with this object to
   *          be notified when Frame, corresponding to your view is resized
   * 
   * @param helpWriter
   *          - you may use this to show context help to user
   * 
   * @return {@link View}
   * @throws BadUrlException
   *           when it considers given url as bad
   * 
   */
  @Override
  Perspective create(ModelUrl url, CloseListenerRegistrator closeListenerRegistrator,
      ResizeListenerRegistrator frlr, HelpWriter helpWriter) throws BadUrlException;
}
